package com.knowledge;

import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author cheyinbo
 * @date 2021/8/31 16:00
 */
public class CASDemo {

    @Test
    public void atomicInteger(){
        AtomicInteger atomicInteger = new AtomicInteger(100);
        atomicInteger.compareAndSet(100,101);
        System.out.println(atomicInteger.get());

        atomicInteger.compareAndSet(101,103);
        System.out.println(atomicInteger.get());
    }
    @Test
    public void test(){
        System.out.println(String.format("%04d",19));
        System.out.println(String.format("%02d",20));
    }

}
